#ifndef Brain_h
#define Brain_h

#include <string>
#include <vector>

#include "Object.h"
#include "Dialog.h"


class Character;

class Brain {

public:
	Brain(lua_State* L);
	~Brain();

	void init();
	osg::Vec3d updatePosition(const osg::Vec3d& position);
	osg::Quat updateAttitude(const osg::Quat& attitude);

	int addStep(lua_State* L);

	inline osg::Vec3d getDirection() {return m_vdirection;}

	int setDialog(lua_State* L);
	inline Dialog* getDialog() {return m_pdialog;};

	enum EVelocity{
		STOP = 0,
		SLOW = 1,
		NORMAL = 2
	}; 

	inline void setVelocity(EVelocity velocity) {m_evelocity = velocity;};
	inline EVelocity getVelocity() {return m_evelocity;};
	
private:
	// Character moving
	EVelocity m_evelocity;

	osg::Vec3d m_vdirection;

	std::vector<osg::Vec3d> m_vstep;
	osg::Vec3d m_vstart;
	osg::Vec3d m_vfinish;

	// Dialogs
	Dialog* m_pdialog;
	
	// Script
	lua_State* m_pscript;
	friend class Lunar<Brain>;
	static const char className[];
	static Lunar<Brain>::RegType methods[];
};

#endif // Brain_h
